package com.ynny.exception.demo01;

import java.util.ArrayList;

public class ExceptionTest02 {

    public static void main(String[] args) {

        //java.lang.IndexOutOfBoundsException:
        // Index 2 out of bounds for length 0
        try {
            ArrayList<String> list = new ArrayList<>();

            String s = list.get(2);

            System.out.println(s);
            //IndexOutOfBoundsException
        }catch (RuntimeException e){

            System.out.println("请检查List集合里面有没有数据呀！！");
        }



    }
}
